package com.huizhan.web;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.huizhan.web.model.*; 

@ControllerAdvice
public class CommExceptionHandler {	
    @ResponseBody	
    @ExceptionHandler(value = Exception.class)
    public ApiResult<String> handle(Exception e){		
        ApiResult<String> msg = new ApiResult<String>();
        if(!e.getMessage().contains("Could not write JSON")){
            msg.setMessage(e.getMessage());
            msg.setHasError(true);
        }
        return msg;	
    }
}